package com.tbsoft.ehr.service.agency;

import java.util.List;

import com.tbsoft.ehr.dao.agency.AgencyDao;
import com.tbsoft.ehr.model.Agency;

public class AgencyServiceImpl implements AgencyService {

	private AgencyDao agencyDao;
	
	public AgencyDao getAgencyDao() {
		return agencyDao;
	}

	public void setAgencyDao(AgencyDao agencyDao) {
		this.agencyDao = agencyDao;
	}

	public List<Agency> getAllAgency() {
		return this.getAgencyDao().getAllAgency();
	}

	public Agency addAgency(Agency agency) {
		return this.getAgencyDao().save(agency);
	}

	public Agency getAgencyByName(String name) {
		List<Agency> agLst = this.getAgencyDao().getAgencyByName(name);
		if(agLst!=null&&agLst.size()>0){
			return agLst.get(0);
		}
		return null;
	}

	public Agency getAgencyById(String id) {
		return this.getAgencyDao().getAgencyById(id);
	}

}
